package com.gdust.hzx.manager.controller;

import com.gdust.hzx.manager.service.OrderInfoService;
import com.gdust.hzx.model.dto.order.OrderStatisticsDto;
import com.gdust.hzx.model.vo.common.Result;
import com.gdust.hzx.model.vo.common.ResultCodeEnum;
import com.gdust.hzx.model.vo.order.OrderStatisticsVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * ClassName: OrderInfoController
 * Package: com.gdust.spzx.manager.controller
 * Description:
 *
 * @Author syun
 * @Create 2024/12/24 17:37
 * @Version 1.0
 */
@RestController// @RestController: 专用于restful风格的注解 = @Controller (控制器) + @ResponseBody (方法返回值为json)
@RequestMapping(value="/admin/order/orderInfo")
public class OrderInfoController {
    //注入订单信息表的service
    @Autowired
    private OrderInfoService orderInfoService;

    /**
     * 统计查询
     * @param orderStatisticsDto 搜索条件实体
     * @return
     */
    @GetMapping("/getOrderStatisticsData")
    public Result getOrderStatisticsData(OrderStatisticsDto orderStatisticsDto){
        //自定义查询：统计查询订单数据
        //注：使用统计结果实体封装统计查询结果
        OrderStatisticsVo orderStatisticsVo =  orderInfoService.getOrderStatisticsData(orderStatisticsDto);
        return Result.build(orderStatisticsVo, ResultCodeEnum.SUCCESS);
    }


}
